local _, GrifonOvaleScripts = ...

GrifonOvaleScripts.script.WARRIOR.Attilio = {
	desc = "[5.4] Attilio: Arms Warrior",
	code =
[[

Define(avatar 107574)
  SpellInfo(avatar duration=24 cd=180 )
  SpellAddBuff(avatar avatar=1)
Define(battle_shout 6673)
  SpellInfo(battle_shout duration=300 cd=60 )
  SpellAddBuff(battle_shout battle_shout=1)
Define(battle_stance 2457)
  SpellInfo(battle_stance cd=3 )
Define(berserker_rage 18499)
  SpellInfo(berserker_rage duration=6 cd=30 )
  SpellAddBuff(berserker_rage berserker_rage=1)
Define(bladestorm 46924)
  SpellInfo(bladestorm duration=6 cd=90 )
  SpellAddBuff(bladestorm bladestorm=1)
Define(bloodbath 113344)
  SpellInfo(bloodbath duration=6 tick=1 )
  SpellAddTargetDebuff(bloodbath bloodbath=1)
Define(bloodsurge 46916)
  SpellInfo(bloodsurge duration=10)
Define(bloodthirst 23881)
  SpellInfo(bloodthirst rage=-10 cd=4.5 )
Define(cleave 845)
  SpellInfo(cleave rage=30 cd=1.5 )
Define(colossus_smash 86346)
  SpellInfo(colossus_smash duration=6.5 cd=20 )
  SpellAddTargetDebuff(colossus_smash colossus_smash=1)
Define(defensive_stance 71)
  SpellInfo(defensive_stance cd=3 )
Define(demoralizing_shout 1160)
  SpellInfo(demoralizing_shout duration=10 cd=60 )
  SpellAddTargetDebuff(demoralizing_shout demoralizing_shout=1)
Define(devastate 20243)
Define(dragon_roar 118000)
  SpellInfo(dragon_roar cd=60 )
Define(enrage 5229)
  SpellInfo(enrage duration=10 rage=-20 cd=60 )
  SpellAddBuff(enrage enrage=1)
Define(execute 5308)
  SpellInfo(execute rage=30 )
Define(heroic_leap 6544)
  SpellInfo(heroic_leap duration=1 cd=45 )
Define(heroic_strike 78)
  SpellInfo(heroic_strike rage=30 cd=1.5 )
Define(heroic_throw 57755)
  SpellInfo(heroic_throw cd=30 )
Define(impending_victory 103840)
  SpellInfo(impending_victory rage=10 cd=30 )
Define(last_stand 12975)
  SpellInfo(last_stand duration=20 cd=180 )
  SpellAddBuff(last_stand last_stand=1)
Define(meat_cleaver 85739)
  SpellInfo(meat_cleaver duration=10 )
  SpellAddBuff(meat_cleaver meat_cleaver=1)
Define(mortal_strike 12294)
  SpellInfo(mortal_strike duration=10 rage=-10 cd=6 )
  SpellAddTargetDebuff(mortal_strike mortal_wounds=1)
Define(overpower 7384)
  SpellInfo(overpower rage=10 )
  SpellAddBuff(overpower taste_for_blood=-1)
Define(pummel 6552)
  SpellInfo(pummel duration=4 cd=15 )
Define(raging_blow 85288)
  SpellInfo(raging_blow rage=10 )
  SpellAddBuff(raging_blow raging_blow_aura=-1)
Define(raging_blow_aura 131116)
  SpellInfo(raging_blow_aura duration=12 )
  SpellAddBuff(raging_blow_aura raging_blow_aura=1)
Define(recklessness 1719)
  SpellInfo(recklessness duration=12 cd=180 )
  SpellAddBuff(recklessness recklessness=1)
Define(revenge 6572)
  SpellInfo(revenge rage=-15 cd=9 )
Define(shield_barrier 112048)
  SpellInfo(shield_barrier duration=6 rage=20 cd=1.5 )
  SpellAddBuff(shield_barrier shield_barrier=1)
Define(shield_block 2565)
  SpellInfo(shield_block rage=60 cd=1.5 )
  SpellAddTargetDebuff(shield_block shield_block_aura=1)
Define(shield_block_aura 132404)
  SpellInfo(shield_block_aura duration=6 )
  SpellAddBuff(shield_block_aura shield_block_aura=1)
Define(shield_slam 23922)
  SpellInfo(shield_slam rage=-20 cd=6 )
Define(shield_wall 871)
  SpellInfo(shield_wall duration=12 cd=300 )
  SpellAddBuff(shield_wall shield_wall=1)
Define(shockwave 46968)
  SpellInfo(shockwave cd=40 )
  SpellAddBuff(shockwave shockwave=1)
Define(skull_banner 114207)
  SpellInfo(skull_banner duration=10 cd=180 )
Define(slam 1464)
  SpellInfo(slam rage=20 )
Define(storm_bolt 107570)
  SpellInfo(storm_bolt cd=30 )
  SpellAddBuff(storm_bolt storm_bolt=1)
Define(sudden_execute 139958)
  SpellInfo(sudden_execute duration=10 )
  SpellAddBuff(sudden_execute sudden_execute=1)
Define(sunder_armor 7386)
  SpellInfo(sunder_armor rage=15 )
  SpellAddTargetDebuff(sunder_armor weakened_armor=1)
Define(sweeping_strikes 12328)
  SpellInfo(sweeping_strikes duration=10 rage=30 cd=10 )
  SpellAddBuff(sweeping_strikes sweeping_strikes=1)
Define(taste_for_blood 56636)
Define(thunder_clap 6343)
  SpellInfo(thunder_clap rage=20 cd=6 )
  SpellAddTargetDebuff(thunder_clap weakened_blows=1)
Define(ultimatum 122510)
  SpellInfo(ultimatum duration=10 )
  SpellAddBuff(ultimatum ultimatum=1)
Define(weakened_armor 113746)
  SpellInfo(weakened_armor duration=30 )
  SpellAddBuff(weakened_armor weakened_armor=1)
Define(weakened_blows 115798)
  SpellInfo(weakened_blows duration=30 )
  SpellAddBuff(weakened_blows weakened_blows=1)
Define(whirlwind 1680)
  SpellInfo(whirlwind rage=30 )
Define(wild_strike 100130)
  SpellInfo(wild_strike rage=30 )
  SpellAddBuff(wild_strike bloodsurge=-1)
  SpellAddTargetDebuff(wild_strike wild_strike=1)
Define(avatar_talent 16)
Define(bloodbath_talent 17)
Define(dragon_roar_talent 12)
Define(impending_victory_talent 6)
Define(shockwave_talent 11)
Define(storm_bolt_talent 18)

Define(charge 100)
	SpellInfo(wild_charge_cat cd=20)
Define(commanding_shout 469)
  SpellInfo(battle_shout duration=300 cd=60 )
  SpellAddBuff(commanding_shout commanding_shout=1)
Define(HEALTHSTONE 5512)
Define(victory_rush 34428)
Define(die_by_the_sword 118038)
	SpellInfo(die_by_the_sword cd=120)
Define(rallyng_cry 97462)
	SpellInfo(rallyng_cry cd=180)
Define(demoralizing_banner)
	SpellInfo(demoralizing_banner cd=180)


AddCheckBox(autocharge "AutoCharge" default)
AddCheckBox(UseCommandingShout "UseCommandingShout")
AddCheckBox(OverpowerBeforeSlam "OverpowerBeforeSlam")
AddCheckBox(AutoInterrupt "AutoInterrupt" default)
AddCheckBox(AutoAOE "AutoAOE" default)
AddCheckBox(AutoHeal "AutoHeal" default)
AddCheckBox(AutoSOS "AutoSOS" default)


AddFunction SoS
{
	if InCombat() 
	{
		if player.HealthPercent() <= 20 Spell(rallyng_cry)
		if player.HealthPercent() <= 40 Spell(die_by_the_sword)
		if player.HealthPercent() <= 30 Spell(demoralizing_banner)
		
	}
}

AddFunction UseGloves
{
	Item(HandsSlot usable=1)
}

AddFunction UseItemActions
{
}

AddFunction Interrupt
{
	if CheckBoxOn(AutoInterrupt) and {target.IsFriend(no) or {target.IsFriend() and target.IsCharmed()} } and target.IsInterruptible()
	{
		if target.InRange(pummel) Spell(pummel)
	}
}

AddFunction Heal
{
	if ItemCount(HEALTHSTONE) >=1 and player.HealthPercent() <= 35 Spell(HEALTHSTONE) 
	if TalentPoints(impending_victory_talent) and player.HealthPercent() <=80 and Rage() >= 10 and target.InRange(mortal_strike) Spell(impending_victory)
        if not TalentPoints(impending_victory_talent) and player.HealthPercent() <=80 and Rage() >= 10 and target.InRange(mortal_strike) Spell(victory_rush)
}

AddFunction SingleTarget
{
	if CheckBoxOn(autocharge) and target.InRange(charge) and not target.InRange(mortal_strike) Spell(charge)
        if target.InRange(mortal_strike)
	{
		if Rage() < 100 or target.DebuffExpires(colossus_smash) Spell(mortal_strike)
        	if target.DebuffRemains(colossus_smash) < 1.5 Spell(colossus_smash)
                if Enemies() <= 3 and target.HealthPercent() < 20 and Rage() >= 30 Spell(execute)
		if SpellUsable(bloodbath) and {target.DebuffPresent(colossus_smash) or SpellCooldown(colossus_smash) < 4 } Spell(bloodbath)
		if not BuffPresent(enrage) and SpellCooldown(colossus_smash) and SpellCooldown(mortal_strike) Spell(berserker_rage)
		UseItemActions()
		if Rage() >= 105 and target.DebuffPresent(colossus_smash) and target.HealthPercent() >= 20
		{
			if Enemies() >= 3 and CheckBoxOn(AutoAOE) Spell(whirlwind)
			Spell(heroic_strike)
        	}
        }        
	if target.InRange(heroic_throw) and SpellUsable(storm_bolt) and target.DebuffPresent(colossus_smash) Spell(storm_bolt)
        if CheckBoxOn(OverpowerBeforeSlam) and Enemies() < 3 and { target.HealthPercent() >=20 or BuffPresent(sudden_execute) } and Rage() >= 10 Spell(overpower usable=1)
	
        if target.InRange(mortal_strike)
	{
   		if target.HealthPercent() < 20 Spell(execute)
		if SpellUsable(dragon_roar) and {not target.DebuffPresent(colossus_smash) and {BuffPresent(bloodbath) or not TalentPoints(bloodbath_talent) } } Spell(dragon_roar)
                if Enemies() >= 3 and CheckBoxOn(AutoAOE) Spell(whirlwind)
		if {target.DebuffPresent(colossus_smash) or {not ArmorSetParts(T16 more 2) and Rage() >90 or ArmorSetParts(T16 more 2) and Rage() >40 } } and target.HealthPercent() >=20 
		{
			Spell(slam)		
		}
		if BuffExpires(sudden_execute) or target.DebuffPresent(colossus_smash) or target.DeadIn() <12 or Rage() >70 if target.HealthPercent(less 20) Spell(execute)
        }
        if not CheckBoxOn(OverpowerBeforeSlam) and Enemies() < 3 and { target.HealthPercent() >=20 or BuffPresent(sudden_execute) } Spell(overpower usable=1)
	if CheckBoxOn(UseCommandingShout) Spell(commanding_shout)
 	if not CheckBoxOn(UseCommandingShout) Spell(battle_shout)
	if target.InRange(heroic_throw) Spell(heroic_throw)
}

AddFunction MultiTarget
{
	Spell(sweeping_strikes)

	if Enemies() == 2 SingleTarget()
        if Enemies() >= 3 
	{
		if target.InRange(mortal_strike) and not target.DebuffPresent(deep_wounds) Spell(thunder_clap)
		SingleTarget()
	}
	
	
}


AddIcon specialization=1 help=main
{
	if not InCombat() 
	{
		unless Stance(warrior_battle_stance) Spell(battle_stance)
                if CheckBoxOn(UseCommandingShout) Spell(commanding_shout)
		if not CheckBoxOn(UseCommandingShout) Spell(battle_shout)
	}

        if CheckBoxOn(AutoHeal) Heal()
        if CheckBoxOn(AutoInterrupt) Interrupt()
        if CheckBoxOn(SOS) SoS()
	if Enemies() > 1 and CheckBoxOn(AutoAOE) MultiTarget()
	SingleTarget()
}





]],
}
